Spain COVID19 Mortality Rate
A <- subset(US,Reported >="2020-07-01")
ggplot(A) + geom_line(aes(x=Reported,y=Rate)) +
scale_y_continuous(labels = scales::percent) +
labs(title="Spain COVID19 Mortality Rate ",x="Date Reported",y="Mortality Rate") +
geom_hline(yintercept = mean(A$Rate),col="red") +
geom_smooth(aes(x=Reported,y=Rate,col="Loess"),span=0.25)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Plot of Daily Cases and Deaths
daily_cases <-ggplot(US) + geom_line(aes(x=Reported,y=Cases,col="Daily Cases")) +
labs(title="COVID-19 Cases by Date") +
geom_point(aes(x=Reported,y=Cases)) +
geom_smooth(aes(x=Reported,y=Cases,col="Loess"),span=0.25)
daily_deaths <-ggplot(US) + geom_line(aes(x=Reported,y=Deaths,col="Daily Deaths")) +
labs(title="COVID-19 Deaths by Date") + ylim(0,1000) +
geom_smooth(aes(x=Reported,y=Deaths,col="Loess"), span=0.25) +
geom_point(aes(x=Reported,y=Deaths))
ggplotly(daily_cases)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
ggplotly(daily_deaths)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 2 rows containing non-finite values (stat_smooth).
USA <- subset(US,Reported >="2020-06-01")
ggplot(USA) + geom_line(aes(x=Reported,y=Cases,col="Daily Cases")) +
labs(title="COVID-19 Cases by Date since Jun. 1, 2020") +
geom_smooth(aes(x=Reported,y=Cases,col="Loess"),span=0.25) +
geom_point(aes(x=Reported,y=Cases))
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

ggplot(USA) + geom_line(aes(x=Reported,y=Deaths,col="Daily Deaths")) +
labs(title="COVID-19 Deaths by Date (since Jun. 1, 2020)") + ylim(0,200) +
geom_smooth(aes(x=Reported,y=Deaths,col="Loess"),span=0.25)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 8 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 row(s) containing missing values (geom_path).
## Warning: Removed 2 rows containing missing values (geom_smooth).

Non-Moving Average By Week and By Month
US$Monthly <- as.Date(cut(US$Reported,
breaks = "month"))
US$Weekly <- as.Date(cut(US$Reported,
breaks = "week",
start.on.monday = FALSE))
Weekly_Cases <- aggregate(Cases~Weekly,US,FUN=sum)
Weekly_Deaths <- aggregate(Deaths~Weekly,US,FUN=sum)
Weekly_Cases$DRate <- Weekly_Deaths$Deaths/Weekly_Cases$Cases
Weekly_Cases$LivedSaved <- Weekly_Cases$Cases * (max(Weekly_Cases$DRate) - Weekly_Cases$DRate)
ggplot(Weekly_Cases) + geom_col(aes(x=Weekly,y=Cases)) +
labs(title="Weekly Cases",x="Date Reported", y="Weekly Cases")

ggplot(Weekly_Deaths) + geom_col(aes(x=Weekly,y=Deaths)) +
labs(title="Weekly Deaths",x="Date Reported", y="Weekly Deaths") +
ylim(0,6000)

Monthly Cases and Deaths
Monthly_Cases <- aggregate(Cases~Monthly,US,FUN=sum)
Monthly_Deaths <- aggregate(Deaths~Monthly,US,FUN=sum)
Monthly_Cases$DRate <- Monthly_Deaths$Deaths/Monthly_Cases$Cases
Monthly_Cases$LivedSaved <- Monthly_Cases$Cases * (max(Monthly_Cases$DRate) - Monthly_Cases$DRate) * 100
ggplot(Monthly_Cases) + geom_col(aes(x=Monthly,y=Cases)) +
labs(title="Monthly Cases") +
scale_y_continuous(labels=scales::comma)

ggplot(Monthly_Deaths) + geom_col(aes(x=Monthly,y=Deaths)) +
labs(title="Monthly Deaths")
